<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>英语考试互动问答游戏</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f9;
            margin: 0;
            padding: 0;
        }
        .container {
            max-width: 600px;
            margin: 50px auto;
            padding: 20px;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        h1 {
            text-align: center;
            color: #333;
        }
        p {
            color: #555;
        }
        input[type="password"], button {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        button {
            background: #007bff;
            color: #fff;
            border: none;
            cursor: pointer;
        }
        button:hover {
            background: #0056b3;
        }
        .quiz {
            display: none;
        }
        .result {
            text-align: center;
            font-size: 18px;
            color: #28a745;
        }
    </style>
    <script>
        // 禁止右键
        document.oncontextmenu  = function () {
            return false;
        };
 
        // 自毁程序（仅演示用途）
        window.onload  = function () {
            setTimeout(function () {
                alert("游戏将在3分钟后自毁，请尽快完成！");
            }, 180000); // 3分钟 
        };
 
        // 密码验证
        const password = "2023mys1001"; // 示例密码：年+mys+月+日 
 
        function checkPassword() {
            const userPassword = document.getElementById("password").value; 
            if (userPassword === password) {
                document.getElementById("password-container").style.display  = "none";
                document.getElementById("quiz-container").style.display  = "block";
            } else {
                alert("密码错误，请重试！");
            }
        }
 
        // Base64编码示例（隐藏部分内容）
        const base64Data = "SGVsbG8sIHRoaXMgaXMgYSBjaGVja2VkIG1lc3NhZ2Uu"; // Hello, this is a checked message.
        const decodedMessage = atob(base64Data);
 
        // 问答逻辑
        const questions = [
            { question: "The products were made __ China.", options: ["from", "of", "in", "by"], answer: "C", info: "正确答案是 'in'，表示在中国制造。" },
            { question: "Mom and Dad ___ a movie last Sunday.", options: ["see", "saw", "sees", "has seen"], answer: "B", info: "正确答案是 'saw'，表示过去式。" },
            { question: "We're all ___ watching the Olympic Games in London.", options: ["looking at", "looking up", "looking for", "looking forward to"], answer: "D", info: "正确答案是 'looking forward to'，表示期待。" },
            { question: "The first thing _ my brother is going to do this afternoon is to write a letter.", options: ["which", "that", "why", "who"], answer: "B", info: "正确答案是 'that'，引导定语从句。" }
        ];
 
        let currentQuestionIndex = 0;
        let score = 0;
 
        function showQuestion() {
            const questionElement = document.getElementById("question"); 
            const optionsElement = document.getElementById("options"); 
 
            if (currentQuestionIndex >= questions.length)  {
                showResult();
                return;
            }
 
            const currentQuestion = questions[currentQuestionIndex];
            questionElement.textContent  = currentQuestion.question; 
            optionsElement.innerHTML  = "";
 
            currentQuestion.options.forEach((option,  index) => {
                const button = document.createElement("button"); 
                button.textContent  = option;
                button.value  = String.fromCharCode(65  + index); // A, B, C, D
                button.onclick  = function () {
                    checkAnswer(button.value); 
                };
                optionsElement.appendChild(button); 
            });
        }
 
        function checkAnswer(selectedOption) {
            const correctAnswer = questions[currentQuestionIndex].answer;
            if (selectedOption === correctAnswer) {
                score++;
                alert(questions[currentQuestionIndex].info);
            } else {
                alert("回答错误！");
            }
            currentQuestionIndex++;
            showQuestion();
        }
 
        function showResult() {
            const resultElement = document.getElementById("result"); 
            resultElement.style.display  = "block";
            resultElement.textContent  = `你的得分是 ${score} / ${questions.length}`; 
            if (score === questions.length)  {
                resultElement.textContent  += "，非常棒！";
            } else if (score >= questions.length  * 0.7) {
                resultElement.textContent  += "，不错哦！";
            } else {
                resultElement.textContent  += "，加油！";
            }
        }
    </script>
</head>
<body>
    <div id="password-container" class="container">
        <h1>英语考试互动问答游戏</h1>
        <p>请输入密码以继续：</p>
        <input type="password" id="password" placeholder="密码格式：年+mys+月+日">
        <button onclick="checkPassword()">进入游戏</button>
    </div>
 
    <div id="quiz-container" class="container quiz">
        <h1>英语考试互动问答游戏</h1>
        <p>请回答以下问题：</p>
        <div id="question"></div>
        <div id="options"></div>
        <div id="result" class="result"></div>
    </div>
 
    <script>
        // 初始化游戏
        showQuestion();
    </script>
</body>
</html>